package com.Image.aop;

import java.lang.annotation.Annotation;

import org.springframework.aop.support.StaticMethodMatcherPointcutAdvisor;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author kevin
 * @desc 入口日志切面
 */
public class EntranceLogPointcutAdvisor extends
		StaticMethodMatcherPointcutAdvisor {
	private static final long serialVersionUID = 2989982268609967936L;

	@Override
	public boolean matches(java.lang.reflect.Method method, Class<?> targetClass) {
		if (!targetClass.getName().matches("com\\.sxs\\.controller\\.[^.]*Controller")) {
			return false;
		}
		Annotation[] annotations = method.getAnnotations();
		for (int i = 0; i < annotations.length; i++) {
			if (annotations[i].annotationType().isAssignableFrom(RequestMapping.class)) {
				return true;
			}
		}
		return false;
	}
}
